package modules
{
	import flash.events.Event;
	
	import framework.core.ComponentBuilder;
	import framework.dao.EntryUtil;
	import framework.view.components.Component;
	
	import modules.enlist.EnlistUI;
	
	import values.enlist.EnlistNumTemplateValueList;
	import values.enlist.EnlistTemplateValueList;
	
	import view.component.window.WindowComponent;

	public class EnlistModule extends ModuleBase
	{
		public function EnlistModule()
		{
			super();
		}
		
		override protected function initConfigComplete():void
		{
			if(!EnlistTemplateValueList.isInited)
			{
				EntryUtil.mapping(XML(configList[data.datas[0].url]).avatars , EnlistTemplateValueList);
				EntryUtil.mapping(XML(configList[data.datas[0].url]).avatars_num , EnlistNumTemplateValueList);
			}
			super.initConfigComplete();
			
			ui = ComponentBuilder.create(EnlistUI) as EnlistUI;
			ui.show();
			
			inited();
			
			ui.addEventListener(Event.CLOSE , onClose);
		}
		
		private var ui:EnlistUI;
		
		private function onClose(evt:Event):void
		{
			ui.removeEventListener(Event.CLOSE , onClose);
			
			ui = null;
			
			dispose();
		}
	}
}